<template>
  <div id="head-tabar">
    <h3 style="font-size: 150%; font-family:monospace; color: white ;margin-left:5%;float: left;">山西省应急管理研究院</h3>
    <div id='schoolTag' style="margin-top: 20px; float: right;margin-right: 30px">
      <el-dropdown style="color: white;font-size: 20px;">
      <span class="el-dropdown-link">
        {{ name }}<i class="el-icon-arrow-down el-icon--right"></i>   
      </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item icon="el-icon-user-solid" @click.native="toUserInfo()">个人资料</el-dropdown-item>
          <el-dropdown-item icon="el-icon-close" @click.native="loginout()">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      
    </div>
  </div>
</template>

<script>
export default {
  name: "HeadTabar",
  data() {
    return {
      school: localStorage.getItem("schoolName"),
      name: localStorage.getItem("userName"),
      headicon: '',
      headImg: localStorage.getItem('userHead'),
    }
  },
  methods:{
    toUserInfo(){
      this.$router.push('/Home/UserInfo')
    },
    loginout(){
      this.$router.push('/Login')
    },
    extractColorByName(name) {
	      var temp = [];
	      temp.push("#");
	      for (let index = 0; index < name.length; index++) {
	        temp.push(parseInt(name[index].charCodeAt(0), 10).toString(16));
	      }
	      return temp.slice(0, 5).join('').slice(0, 4);
	    },
  }
}
</script>

<style scoped>
#head-tabar {
  background: #918b8b;
  /*background-image: url("../assets/headbar.jpg");*/
  /*background-size: 100% 100%;*/
  width: 100%;
  height: 70px;
  position: absolute;
  
  
}


</style>
